﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JXT.PrimaryKey.Batman.Collections;
using JXT.PrimaryKey.Batman.Domain.Models;
using JXT.PrimaryKey.Batman.Domain.Specifications;

namespace JXT.PrimaryKey.Batman.Domain.Repositories
{
    /// <summary>
    /// 可读存储接口
    /// </summary>
    /// <typeparam name="TEntity">模型类型</typeparam>
    /// <typeparam name="TKey">模型主键类型</typeparam>
    public interface IReadRepository<TEntity, TKey> : IRepository<TEntity> where TEntity : IEntity
    {
        /// <summary>
        /// 给定主键的模型是否存在
        /// </summary>
        /// <param name="key">模型主键</param>
        /// <returns>查询结果</returns>
        bool Exists(TKey key);

        /// <summary>
        /// 获取单条模型对象
        /// </summary>
        /// <param name="key">主键对象</param>
        /// <returns>查询值，未找到为null</returns>
        TEntity GetSingle(TKey key);

        /// <summary>
        /// 获取所有模型记录集合
        /// </summary>
        /// <returns>查询到的集合</returns>
        IEnumerable<TEntity> GetList();
    }
}
